package com.stylefeng.guns.rest.schedule;

import com.stylefeng.guns.rest.Util.InitDefineCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Async
public class ScheduledService {

    @Autowired
    private InitDefineCache initDefineCache;

    /**
     * 每天凌晨三点固定刷新线路缓存
     */
    @Scheduled(cron = "0 0 1 * * ? *")
    public void scheduledAutoTask(){
       try {
           initDefineCache.init();
        }catch(Exception e){

        }
    }
}
